package com.suray.wcs.service.core.path.api;

import com.suray.basic.wcs.path.core.Node;
import com.suray.basic.wcs.utils.Coord;
import com.suray.wcs.service.pojo.Rgv;

import java.util.List;

public interface DeadlockHandle {
    /**
     * 判断是否为死锁
     *
     * @return
     */
    boolean isDeadlock();

    /**
     * 执行让路, 返回让路结果
     *
     * @return
     */
    boolean avoid();

    boolean waitAvoid();

    /**
     * 执行绕路, 返回绕路结果
     *
     * @return
     */
    boolean detour();

    /**
     * 选取最优避让点
     * @param availableNodeList 避让点集合
     * @param rgv 避让车辆
     * @return
     */
    Node getBestAvoidNode(List<Coord> availableNodeList, Rgv rgv);
    /**
     * 选取最优避让点
     * @param availableNodeList 避让点集合
     * @param rgv 避让车辆
     * @return
     */
    Node getBestAvoidNode(List<Coord> availableNodeList, Rgv rgv, List<Coord> disableNodeList);

    Node getAvoidNode(Rgv rejectRgv, Rgv avoidRgv, boolean isWaitAvoid);
}
